package com.generator.collet.controller;


import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * <p>
 * 班级大事件 前端控制器
 * </p>
 *
 * @author tiankun
 * @since 2023-06-09
 */
@RestController
@RequestMapping("/collet/sch-event-eval-entity")
public class SchEventEvalController {

    public static void main(String[] args) {
//        LocalDateTime dt1
//                = LocalDateTime.parse("2023-02-13T00:00:00");
//        LocalDateTime localDateTime = dt1.minusDays(1);
//        System.out.println(localDateTime.toString());
//
//        DateTime date = DateUtil.date();
//        DateTime yesterday = DateUtil.yesterday();
//        DateTime lastWeek = DateUtil.lastWeek();
//        System.out.println(DateUtil.format(DateUtil.beginOfWeek(yesterday), "yyyy-MM-dd HH:mm:ss"));
//        System.out.println(DateUtil.format(DateUtil.endOfWeek(yesterday), "yyyy-MM-dd HH:mm:ss"));
//
//        System.out.println(DateUtil.format(lastWeek, "yyyy-MM-dd HH:mm:ss"));
//        System.out.println(DateUtil.format(DateUtil.endOfWeek(lastWeek), "yyyy-MM-dd HH:mm:ss"));
//
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(date);
//        calendar.add(Calendar.DATE, -6);
//        System.out.println(DateUtil.beginOfDay(calendar.getTime()));
//        System.out.println(DateUtil.endOfDay(date));


        String str = "体温36.5度51";
        String regEx = "[^0-9|.]";
        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(str);
        String result = m.replaceAll("").trim();
        System.out.println(result);
        System.out.println(new BigDecimal(result).setScale(1,BigDecimal.ROUND_HALF_UP));
    }


}

